<template>

  <div class="Public">
    <div class="data-theme-title pt116">
      <div class="main">
        <h3>信息公开</h3>
<!--    <span class="subtitle">公示期内，任何单位和个人，如对审查意见有异议的，均可向住建厅书面反映情况。</span>-->
      </div>
    </div>
    <div class="choose">
      <div class="main flex">
        <section
            v-for="(item, index) in publicTypes"
            :key="index" :class="`${activeKey === item.key ? 'active' : ''}`"
            @click="jumpPublic(item.path ,item.key)">
          <span>{{ item.label }}</span>
        </section>
      </div>

    </div>
  </div>

  <div class="base-info-list">
    <div class="main">
      <RouterView />
    </div>
  </div>

</template>

<script lang="ts" >
import {defineComponent, ref , } from "vue";
import { useRouter , useRoute} from "vue-router";
import type { configItem } from '/@/api/common';
interface publicItem extends configItem{
  key: string;
  path: string;
}

export default defineComponent({
  name: "Public",
  components: {},
  setup() {
    const router = useRouter();
    let { path } = useRoute();
    const activeKey = ref<string>(path=='/public/department'?'department':'matter');
    const publicTypes = ref<publicItem[]>([
      { path: "/public/matter", label: "按事项公开", key: "matter" },
      { path: "/public/department", label: "按部门公开", key: "department" }
    ]);
    const jumpPublic = ( path: string,key:string) => {
      activeKey.value = key;
      router.push({ path: path });
    };
    return { publicTypes, activeKey,  jumpPublic };
  },
});
</script>

<style lang="less" scoped>
.Public {
  position: relative;
  background: #f4f6fa;

  .data-theme-title {
    background: url(/public/resource/image/publicbanner.png) no-repeat center/cover;

    .main {
      height: 244px;

      h3 {
        position: relative;
        padding-top: 50px;
        margin-top: 0;
        font-size: 36px;
        font-weight: 400;
        line-height: 62px;
        color: white;


      }

      .subtitle {
        display: block;
        width: 649px;
        font-size: 16px;
        font-weight: 500;
        line-height: 24px;
        color: white;
      }
    }
  }

  .choose {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(1, 8, 20, .4);

    .flex{
      padding-top: 15px;

      section{
        position: relative;
        margin-right: 100px;
        font-size: 18px;
        color: rgba(255,255,255,0.8);
        cursor: pointer;
        user-select: none;

        &::after{
          position: absolute;
          bottom: -16px;
          left: 50%;
          display: inline-block;
          width: 40px;
          height: 4px;
          margin-left: -20px;
          background: transparent;
          content: '';
        }

        &.active{
          color: rgba(255,255,255,1);
        }

        &.active::after{
          background: #0078FF;
        }
      }
    }
  }
}
</style>


